package br.com.miboco.client;


import java.util.ArrayList;
import java.util.Observer;

import br.com.miboco.patterns.observer.ButtonObservable;
import br.com.miboco.patterns.strategy.buttons.ButtonStrategyComponent;
import br.com.miboco.patterns.strategy.buttons.HorizontalButtonComponent;
import br.com.miboco.patterns.strategy.buttons.VerticalButtonComponent;
import br.com.miboco.patterns.template.post.PostTemplateComponent;
import br.com.miboco.patterns.template.post.RichAreaPostComponent;
import br.com.miboco.patterns.template.post.TextAreaPostComponent;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.DockPanel.DockLayoutConstant;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.RootPanel;


public class MiBoCo  implements EntryPoint {
	private RootPanel areaPanel;
	private HorizontalButtonComponent horizontalButton;
	private VerticalButtonComponent verticalButton;
	private PostTemplateComponent post;
	private DockPanel dockPanel;
	private ButtonObservable observable;
	
	public MiBoCo(){
		areaPanel = RootPanel.get("areaentry");
		observable = new ButtonObservable();
		
		horizontalButton = new HorizontalButtonComponent( observable );
		verticalButton = new VerticalButtonComponent( observable );
		
		observable.addObserver(horizontalButton);
		observable.addObserver(verticalButton);
		
		post = new TextAreaPostComponent();
		dockPanel = new DockPanel();
		
		horizontalButton.setVisible(true);
		verticalButton.setVisible(false);
	}
	
	@Override
	public void onModuleLoad() {
		dockPanel.add(horizontalButton, DockPanel.NORTH);
		dockPanel.add(verticalButton, DockPanel.EAST);
		dockPanel.add(post, DockPanel.CENTER);
		areaPanel.add(dockPanel);
		
		for(PushButton button: horizontalButton.getPushButtons())
			horizontalButton.add(button);
		
		for(PushButton button: verticalButton.getPushButtons())
			verticalButton.add(button);
		
		
	}
	
	

}
